﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace NL.ADA.Common
{
    [Serializable]
    public class CustomConfig
    {
        private int _configTypeId;
        public CustomConfig()
        {
        }
        public int ConfigId { get; set; }
        public string Key { get; set; }
        public string Value { get; set; }
        public int ConfigTypeId { get; set; }
        public string ConfigTypeName { get; set; }
        public Type ConfigType { get; set; }
        public int ApplicationId { get; set; }
        public int ModeId { get; set; }
        public string ApplicationCode { get; set; }
        public string ModeName { get; set; }
        public static Type GetTypeFromConfigTypeId(int configTypeId)
        {
            switch (configTypeId)
            {
                case ((int)ConfigTypeEnum.ConfigType_Int16):
                    return typeof(Int16);
                case ((int)ConfigTypeEnum.ConfigType_Int32):
                    return typeof(Int32);
                case ((int)ConfigTypeEnum.ConfigType_Int64):
                    return typeof(Int64);
                case ((int)ConfigTypeEnum.ConfigType_Double):
                    return typeof(double);
                case ((int)ConfigTypeEnum.ConfigType_Decimal):
                    return typeof(decimal);
                case ((int)ConfigTypeEnum.ConfigType_DateTime):
                    return typeof(DateTime);
                case ((int)ConfigTypeEnum.ConfigType_String):
                    return typeof(string);
            }
            return null;
        }

    }
}
